/**
 * Created with Vim7.3 ubuntu12.04
 * @fileOverview :  setting
 * @author : Lyle <lylechen2014@gmial.com>
 * @since : 2014-09-12 11:00:47
 * @filename : static/nmm/src/views/index.js
 * @version : 
 * @description : 
 */
define(function(require, exports, module){

    var SetView,mId = 'setting',reRender = false,menuName = 'setting',
        imglazyload = require('{component}imglazyload/zepto.imglazyload'),
        panel = require('{component}panel/zepto.panel'),
        tplN = require('{view}userNav.tpl'),
        tpl = require('{view}setting.tpl');

    SetView = Backbone.View.extend({

        el: '',

        template: _.template(tpl),
        templateN: _.template(tplN),

        initialize: function () {

        },

        bindEvt : function() {
            var tthis = this,dom=$('#'+mId);
   
            dom.find('.left').on('tap',function(e){
                if (panel.info.state == 'hidden') {
                    panel.show();
                } else {
                    panel.hidden(); 
                }
            });

            dom.find('.logout').on('tap',function(){
                if(confirm('Are you sure to sign out!')) { 
                   share.loginOut();
                }
            });

            dom.find('#accountSet').on('tap',function(){
                window.location.href = '#changePassword/whole';
            });

            dom.find('#feedBack').on('tap',function(){
                window.location.href = '#feedback/whole';
            });

            dom.find('#fullSite').on('tap',function(){
                window.location.href = mainSite;
            });
     
            dom.find('#oldSite').on('tap',function(){
                window.location.href = oldSite;
            });

        },

        render: function (obj) {
            if (!share.checkPermission(true)){return;};
            share.reRender(reRender,mId);
            if ($('#'+mId).length < 1) {
                $('body').append(this.template(lang));
                this.bindEvt();
            } else {
                $('#'+mId).css('display','block');
            }
            share.panel(panel,this.templateN,mId,menuName);
        }
    });

    module.exports = SetView;
})

